package 策略模式

import "fmt"

type iexecuter interface {
	execute()
}

type planA struct {
}

func (a *planA) execute() {
	// do something
	fmt.Println("A site!")
}

type planB struct {
}

func (b *planB) execute() {
	// do something
	fmt.Println("B site!")
}

type executor struct {
	plan iexecuter
}

func newExecutor() *executor {
	return &executor{}
}

func (e *executor) SetPlan(i iexecuter) {
	e.plan = i

}

func (e *executor) execute() {
	e.plan.execute()
}
